#include <iostream>
#include <string>
#include <vector>
using namespace std;

//TODO
int main(){
    string str;
    vector<string> vec;
    while (cin>>str){
        if (!(str=="+"||str=="-"||str=="*"||str=="/")){
            vec.push_back(str);
        }
        else {
            int num2=stoi(vec.back());
            vec.pop_back();
            int num1=stoi(vec.back());
            vec.pop_back();
            int result;
            if (str=="+"){
                result=num1+num2;
            }
            else if (str=="-"){
                result=num1-num2;
            }
            else if (str=="*"){
                result=num1*num2;
            }
            else if (str=="/"){
                result=num1/num2;
            }
            vec.push_back(to_string(result));
        }
        if (cin.get()=='\n') break;
    }
    
    cout<<"result = "<<vec.back()<<endl;
    return 0;

    
}